<?php
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|,'api.logs'
*/

use App\Http\Controllers\Api\ActivityController;
use App\Http\Controllers\Api\AuthController;
use App\Http\Controllers\Api\MedicalController;
use App\Http\Controllers\Api\MemberController;
use App\Http\Controllers\Api\SystemController;
use Illuminate\Support\Facades\Route;

/**
 * JWT 用户鉴权基础路由.
 * laravel-box定义.
 */
Route::group([
    'prefix' => 'auth',
    'middleware' => ['allow', 'refresh'], // 允许跨域 、 刷新中间件
], function ($router) {
    $router->post('logout', [AuthController::class, 'logout']);
    $router->post('me', [AuthController::class, 'me']);
    $router->post('certification', [MemberController::class, 'doctorCert']); //医师资格认证
    $router->get('myCert', [MemberController::class, 'myCert']); // 我的医师资格认证
    $router->post('medical', [MedicalController::class, 'createMedical']); // 发布病例
    $router->post('myMedical', [MemberController::class, 'getMedicalList']); // 我的病例
    $router->post('delMedical', [MedicalController::class, 'delMedical']); // 删除病例
    $router->post('getReason', [MemberController::class, 'getReason']); // 获取审核意见


    // $router->get('medicalList', [MemberController::class, 'getMedicalLists']); // 我的病例(select用)

});


// auth用户
Route::group([
    'prefix' => 'auth',
    'middleware' => ['allow'], // 允许跨域
], function ($router) {
    $router->post('refresh', [AuthController::class, 'refresh']);
    // 注册
    $router->post('register', [AuthController::class, 'register']);
    // 登录
    $router->post('login', [AuthController::class, 'login']);
    // 忘记密码
    $router->post('login/forget', [AuthController::class, 'forgetPassword']);
});

// 系统配置
Route::group([
    'prefix' => 'system',
    'middleware' => ['allow'], // 允许跨域
], function ($router) {
    // 获取用户身份
    // $router->get('identity', [SystemController::class, 'userType']);
    // 发送验证码
    $router->post('sms', [SystemController::class, 'sendCode']);
    // $router->get('cate', [SystemController::class, 'category']);
    // $router->post('upload', [SystemController::class, 'upload']);
    // $router->get('activityCate', [SystemController::class, 'categoryByActivity']);

    // 获取七牛云token
    $router->get('qiniuToken', [SystemController::class, 'getQiniuToken']);
    //  $router->post('sms11', [SystemController::class, 'sendCode11']);
    // $router->get('download', [ActivityController::class, 'downloadMedicalTemplate']);
});

// 活动专题
Route::group([
    'prefix' => 'topic',
    'middleware' => ['allow'], // 允许跨域
], function ($router) {
    // 活动专题列表
    // $router->post('list', [ActivityController::class, 'ActivityTopicList']);
    // 活动专题病例列表
    // $router->post('medical', [ActivityController::class, 'medicalTopicList']);

    // 活动专题病例列表
    // $router->post('medicalNew', [ActivityController::class, 'medicalTopicListNew']);
    // $router->get('category', [ActivityController::class, 'topicCategoryList']);

    // 2022-02-06 新增赛区信息接口
    $router->get('division/info', [ActivityController::class, 'divisionInformation']);
    // $router->get('division/category', [ActivityController::class, 'getDivisionArea']);
});

// 病例
Route::group([
    'prefix' => 'medical',
    'middleware' => ['allow'], // 允许跨域
], function ($router) {
    // 推荐病例列表
    // $router->get('hot', [MedicalController::class, 'hotRecommend']);
    // 根据活动推荐病例列表
    // $router->get('activityHot', [MedicalController::class, 'hotRecommendByActivity']);
    // 病例详情
    $router->post('detail', [MedicalController::class, 'getDetail']);
    // todo 验证邀请码接口
    $router->post('checkInvitationCode', [MedicalController::class, 'checkCode']);
    // 所有选项
    $router->post('checkBox', [SystemController::class, 'checkBox']);
    // 搜索病例
    // $router->post('list', [MedicalController::class, 'getList']);
    // 下载病例模板
    // $router->get('download', [ActivityController::class, 'downloadMedicalTemplate']);
});
